package learnjava.basic.other;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class GetIp {

    public static void main(String[] args) {

        try {
            String name = "www.bilibili.com";
            InetAddress[] addresses = InetAddress.getAllByName(name);
            for (int i = 0; i < addresses.length; i++) {
                System.out.println(name + "[" + i + "]: "
                        + addresses[i].getHostAddress());
            }
        } catch (UnknownHostException uhe) {
            System.err.println("Unable to find: " + args[0]);
        }
    }
}